package cn.denny.designpattern.iterator;

public class ListImpl<T> implements List<T>{
	private T[] datas;
	private int index;
	private int size;
	public ListImpl(){
		index = 0;
		size = 0;
		datas = (T[])new Object[100];
	}
	@Override
	public AbstractIterator<T> iterator() {
		return new IteratorImpl<T>(this);
	}

	@Override
	public int getSize() {
		return size;
	}

	@Override
	public void add(T data) {
		datas[index++] = data;
		size++;
	}

	@Override
	public T get(int index) {
		return datas[index];
	}

}
